<?php
namespace app\index\controller;
use think\Controller;

class Index extends Base
{
    public function index()
    {
        $this->assign('hostname',config('hostname'));
        return $this->fetch();
    }

    public function website(){
        return $this->fetch();
    }

    public function weixin(){
        vendor('zoujingli/wechat-developer/include');
        $config = [
            'token'          => 'lzh',
            'appid'          => 'wx5215830385f894de',
            'appsecret'      => 'd2ef7007979190044fac3c81bb2fe204',
            'encodingaeskey' => '',
        ];

        $user = new \WeChat\Oauth($config);

        // 调用接口对象方法
        $url = $user->getOauthRedirect("http://www.fjcnhk.top/index/index/weixin1");
        header('Location: '.$url);exit;
    }
    public function weixin1(){
        vendor('zoujingli/wechat-developer/include');
        $config = [
            'token'          => 'lzh',
            'appid'          => 'wx5215830385f894de',
            'appsecret'      => 'd2ef7007979190044fac3c81bb2fe204',
            'encodingaeskey' => '',
        ];

        $user = new \WeChat\Oauth($config);

        // 调用接口对象方法
        $list = $user->getOauthAccessToken();
        dd(11, $list);
    }
}
